package com.oneraku.service.config;

import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.UnsynchronizedAppenderBase;
import com.alibaba.fastjson.JSONObject;
import com.oneraku.service.service.ILogbackService;
import lombok.extern.slf4j.Slf4j;

/**
 * @Author: hui.ren@huberbuy.com
 * @Date: 2020/2/26 15:36
 */
@Slf4j
public class MysqlAppender extends UnsynchronizedAppenderBase<ILoggingEvent> {
    @Override
    protected void append(ILoggingEvent loggingEvent) {
        ILogbackService logbackService = ApplicationContextProvider.getBean(ILogbackService.class);
        if (logbackService != null) {
            log.info(loggingEvent.getMessage());
        }
    }
}
